import request from '@/utils/request'

export function reg(data) {
  return request({
    url: '/auth/reg',
    method: 'post',
    data
  })
}

export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/auth',
    method: 'post',
		data:{token}
  })
}

export function getUserByToken() {
  return request({
    url: '/auth',
    method: 'post'
  })
}

export function updateUserInfo(data) {
	return request({
	  url: '/user/updateUserInfo',
	  method: 'put',
		data
	})
}

export function updateAttr(data) {
	return request({
	  url: '/user/updateAttr',
	  method: 'put',
		data
	})
}

export function setShares(data) {
	return request({
	  url: '/user/setShares',
	  method: 'post',
		data
	})
}

export function getShares(params) {
	return request({
	  url: '/user/shares',
	  method: 'get',
		params
	})
}

export function cancelShare(data) {
	return request({
	  url: '/user/cancelShare',
	  method: 'delete',
		data
	})
}

export function getUsersByName(name,project_id) {
	return request({
	  url: '/user/getUsersByName',
	  method: 'get',
		params:{name:name,project_id}
	})
}

export function updateRole(data){
	return request({
	  url: '/user/updateRole',
	  method: 'put',
		data
	})
}

export function getManagers(name){
	return request({
	  url: '/user/managers',
	  method: 'get',
		params:{name}
	})
}

export function setManager(data){
	return request({
	  url: '/user/manager',
	  method: 'post',
		data
	})
}
